
package com.cptravel.activity.index;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.core.controller.B5MBaseFragment;
import com.core.util.B5MActivityHelper;
import com.core.util.B5MBitmapHelper;
import com.cptravel.R;
import com.cptravel.activity.hot.HotDetailActivity;
import com.cptravel.bean.IndexPics;
import com.cptravel.bean.Product;

public class IndexOneFragment extends B5MBaseFragment
{
    ImageView imageView;
    IndexPics indexPics;

    @Override
    public int doGetContentViewId()
    {
        // TODO Auto-generated method stub
        return R.layout.index_one;
    }

    @Override
    public void doInitSubViews(View containerView)
    {
        // TODO Auto-generated method stub
        imageView = (ImageView) containerView.findViewById(R.id.iv_pic);
        imageView.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                // TODO Auto-generated method stub
                if (!TextUtils.isEmpty(indexPics.link_id))
                {
                    Bundle bundle = new Bundle();
                    Product product = new Product();
                    product.id = indexPics.link_id;
                    B5MActivityHelper.startActivity(mActivity, HotDetailActivity.class, bundle);
                }
            }
        });
    }

    @Override
    public void doInitDataes()
    {
        // TODO Auto-generated method stub
        indexPics = (IndexPics) getArguments().getSerializable("pic");
    }

    @Override
    public void doAfter()
    {
        // TODO Auto-generated method stub
        B5MBitmapHelper.displayDefaultNotPeopleNotRoundImage(indexPics.link_src, imageView);
    }
}
